/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jps.qres;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author calyJa
 */
public class StructResult extends AbstractQueryResult {
    
    private List<AbstractQueryResult> elements = new ArrayList<AbstractQueryResult>();

    public StructResult(List<AbstractQueryResult> results) {
        for (AbstractQueryResult result : results) {
            elements.add(result);
        }
    }

    public void addResult(AbstractQueryResult result) {
        elements.add(result);
    }    
    
    public List<AbstractQueryResult> getElements() {
        return elements;
    }
    
    public int getSize() {
        return elements.size();
    }
    
    @Override
    public String toString() {
        String result = "struct(";
        int i = 0;
        for (AbstractQueryResult element : elements) {
            result += i++ + " = " + element.toString();
            if (i < elements.size()) {
                result += ", ";
            }
        }
        result += ")";
        return result;
    }
    
}